﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="ShopSpace.Core" namespace="ShopSpace.Core">
	<class name="WorkItem" table="pm_WorkItem" lazy="true" >
		<id name="Id" type="Int32">
			<column name="Id" length="4" not-null="true" sql-type="INT"/>
			<generator class="identity" />
		</id>
		<version name="ConcurrencyDate" type="Timestamp"  />
		<property name="AddedBy" type="String" >
			<column name="AddedBy" length="100" not-null="true" sql-type="VARCHAR(100)"/>
		</property>
		<property name="AddedDate" type="DateTime" >
			<column name="AddedDate" length="8" not-null="true" sql-type="DATETIME"/>
		</property>
		<property name="UpdatedBy" type="String" >
			<column name="UpdatedBy" length="100" not-null="false" sql-type="VARCHAR(100)"/>
		</property>
		<property name="UpdatedDate" type="DateTime" >
			<column name="UpdatedDate" length="8" not-null="false" sql-type="DATETIME"/>
		</property>
		<many-to-one name="Project" class="Project" lazy="proxy" foreign-key="FK_WorkItem_Project">
			<column name="ProjectId" length="4" not-null="true" sql-type="INT" unique-key="Project_Description"/>
		</many-to-one>
		<property name="Summary" type="String">
			<column name="Summary" length="200" not-null="true" sql-type="VARCHAR(200)" unique-key="Project_Description"/>
		</property>
		<property name="Description" type="String">
			<column name="Description" length="16" not-null="true" sql-type="VARCHAR(MAX)"/>
		</property>
		<many-to-one name="ReportedBy" class="Person" lazy="proxy" foreign-key="FK_WorkItem_ReportedByPerson">
			<column name="ReportedByPersonId" length="4" not-null="true" sql-type="INT"/>
		</many-to-one>
		<many-to-one name="AssignedTo" class="Person" access="field.camelcase" lazy="proxy" foreign-key="FK_WorkItem_AssignedToPerson">
			<column name="AssignedToPersonId" length="4" not-null="false" sql-type="INT"/>
		</many-to-one>
		<many-to-one name="Status" class="WorkItemStatus" lazy="proxy" foreign-key="FK_WorkItem_WorkItemStatus">
			<column name="WorkItemStatusId" length="4" not-null="true" sql-type="INT"/>
		</many-to-one>
		<many-to-one name="Category" class="WorkItemCategory" lazy="proxy" foreign-key="FK_WorkItem_Category">
			<column name="WorkItemCategoryId" length="4" not-null="true" sql-type="INT"/>
		</many-to-one>
		<many-to-one name="Milestone" class="Milestone" access="field.camelcase" lazy="proxy" foreign-key="FK_WorkItem_Milestone">
			<column name="MilestoneId" length="4" not-null="false" sql-type="INT"/>
		</many-to-one>
		<property name="Priority" type="Int32">
			<column name="Priority" length="4" not-null="true" sql-type="INT"/>
		</property>
		<bag name="LogEntries" cascade="all" order-by="AddedDate ASC" inverse="true">
			<key column="WorkItemId" />
			<one-to-many class="LogEntry" />
		</bag>
	</class>
</hibernate-mapping>